<?php
/* @var $this TeacherController */
/* @var $model Teacher */

Yii::app()->clientScript->registerScript('selectCourse', ' 
    $("#sele").on("click", function() {
        var data = new Array();
        $("[type=checkbox]:not(:first):checked").each(function() {
                data.push($(this).val());
         });
         if (data.length <= 0)
         {
            data.push(0);
         }
            $.post(location.href, {"data[]": data}, function(res) {
                $("#notice").text(res);
            });
    });');

$this->breadcrumbs=array(
	'教学团队管理'=>array('admin'),
	$teacher->teacher_name => array('teacher/view', 'id'=>$teacher->teacher_id),
                      '管理课程',
);

$this->menu=array(
                     array('label'=> '返回', 'url'=>array('teacher/view', 'id'=>$teacher->teacher_id)),
                     array('label'=>'返回教学团队管理', 'url'=>array('admin')),
	array('label'=>'创建新教师资料', 'url'=>array('create')),
);
?>

<h1>管理课程</h1>

<?php
$this->widget('zii.widgets.grid.CGridView', array(
        'id' => 'teacher-grid',
        'dataProvider' => $course->search(),
        'filter' => $course,
        'columns' => array(
                array(
                        'class' => 'CCheckBoxColumn',
                        'selectableRows' => 2,
                        'checked' => 'CourseTeacher::filterTeacher($data->course_id, '. $teacher->teacher_id .')',
                ),
                'course_name',
                array(
                        'header' => '创建者',
                        'value' => '$data->user->user_name',
                ),
                'create_date',
        ),
));
?>

<div id="notice" style="color: red"></div>

<?php
echo CHtml::submitButton('提交', array('id'=>'sele'));